package system

import (
	"github.com/flipped-aurora/gin-vue-admin/server/middleware"
	"github.com/gin-gonic/gin"
)

type DeviceRouter struct{}

func (s *DeviceRouter) InitDeviceRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
	deviceRouter := Router.Group("device").Use(middleware.OperationRecord())
	deviceRouterWithoutRecord := Router.Group("device")
	deviceRouterWithoutAuth := PublicRouter.Group("device")
	{
		deviceRouter.POST("createDevice", deviceApi.CreateDevice)
		deviceRouter.DELETE("deleteDevice", deviceApi.DeleteDevice)
		deviceRouter.DELETE("deleteDeviceByIds", deviceApi.DeleteDeviceByIds)
		deviceRouter.PUT("updateDevice", deviceApi.UpdateDevice)
	}
	{
		deviceRouterWithoutRecord.GET("findDevice", deviceApi.FindDevice)
		deviceRouterWithoutRecord.GET("getDeviceList", deviceApi.GetDeviceList)
	}
	{
		deviceRouterWithoutAuth.GET("getDevicePublic", deviceApi.GetDevicePublic)
		deviceRouterWithoutAuth.GET("SearchDevice", deviceApi.SearchDevice)
		deviceRouterWithoutAuth.GET("running", deviceApi.Running)
		deviceRouterWithoutAuth.GET("realtime", deviceApi.Realtime)
		deviceRouterWithoutAuth.GET("address", deviceApi.Address)
	}
}
